﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SmartSpace.Service.Data
{
    public class BaseResult
    {
        public bool IsSuccess { get; set; }
        public string Message { get; set; }

        public BaseResult()
        {
            IsSuccess = false;
            Message = "没有数据";
        }

        public BaseResult(bool isSuccess, string message)
        {
            IsSuccess = isSuccess;
            Message = message;
        }
    }

    public class SingleResult<T> : BaseResult
    {
        public T Data { get; set; }

        public SingleResult()
        {
            IsSuccess = false;
            Message = "没有数据";
            Data = default(T);
        }

        public SingleResult(bool isSucess, string message, T data)
        {
            IsSuccess = isSucess;
            Message = message;
            Data = data;
        }
    }

    public class ListResult<T> : BaseResult
    {
        public List<T> Data { get; set; }

        public ListResult()
        {
            IsSuccess = false;
            Message = "没有数据";
            Data = null;
        }

        public ListResult(bool isSucess, string message, List<T> data)
        {
            IsSuccess = isSucess;
            Message = message;
            Data = data;
        }
    }

    public class PagedResult<T> : BaseResult
    {
        public List<T> Data { get; set; }
        public int Start { get; set; }
        public int Limit { get; set; }
        public int TotalCount { get; set; }

        public PagedResult()
        {
            IsSuccess = false;
            Message = "没有数据";
            Data = null;
        }

        public PagedResult(bool isSucess, string message, List<T> data, int start, int limit, int totalCount)
        {
            IsSuccess = isSucess;
            Message = message;
            Data = data;

            Start = start;
            Limit = limit;
            TotalCount = totalCount;
        }
    }
}